package com.offer;


import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Test46 {

    int count = 0;

    public int translateNum(int num) {
        char[] numChars = String.valueOf(num).toCharArray();

        dfs(numChars.length, String.valueOf(num), 0);

        return count;
    }

    private void dfs(int length, String numString, int index) {
        if (index == numString.length()) {
            count++;
            return;
        }

        dfs(length, numString, index + 1);

        if (index + 1 < length && numString.charAt(index) != '0') {
            if (Integer.parseInt(numString.substring(index, index + 2)) <= 25) {
                dfs(length, numString, index + 2);
            }
        }
    }

    public static void main(String[] args) {
        Test46 test = new Test46();
//        System.out.println(test.translateNum(12258));
        System.out.println(test.translateNum(506));
    }

}
